package com.training.thread.section02;

import com.training.thread.section01.MyThread;

public class ThreadBlock03 extends Thread {
	@Override
	public void run() {
		for(int i = 0 ; i < 10 ; i++) {
			System.out.println(this.getName()+":"+i);
			try {
				sleep(200);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

	public static void main(String[] args) throws Exception {
		Thread t1 = new MyThread();
		t1.setName("A");
		Thread t2 = new MyThread();
		t2.setName("B");
		
		t1.start();
		t1.join();//t1完成后再执行别的
		t2.start();
	}

}
